package com.smart.five.ioc.annotation.scope;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.serviceloader.ServiceListFactoryBean;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * @author junrui.wang
 * @create 2018/6/14
 */
@Component
public class Boss {
    private Car car;

    public Boss() {
        System.out.println("constructor");
    }

    public Car getCar() {
        return car;
    }

    @Autowired
    public void setCar(Car car) {
        System.out.println("setCar");
        this.car = car;
    }

    @PostConstruct  //相当于init-method,
    public void initMethod1(){
        System.out.println("initMethod1");
    }

    @PostConstruct
    public void initMethod2(){
        System.out.println("initMethod2");
    }

    @PreDestroy
    public void destroyMethod1(){
        System.out.println("destroyMethod1");
    }

    @PreDestroy
    public void destroyMethod2(){
        System.out.println("destroyMethod2");
    }
}
